% V20210224 - 13.9 Changing Panel Content INCLUDE "GW.bas" % Create a page. p = GW_NEW_PAGE() % Prepare title bar string. Title$ = GW_ADD_BAR_TITLE$("Changing panel content") % Add title to page. GW_ADD_TITLEBAR(p, Title$) % Create initial panel code. html$ = GW_ADD_TITLE$("Settings") html$ += GW_ADD_TEXT$("Choose an option (you cannot go back!)") html$ += GW_ADD_RADIO$(0, "First option") first_radio = GW_LAST_ID() html$ += GW_ADD_RADIO$(first_radio, "Second option") html$ += GW_ADD_RADIO$(first_radio, "Third option") html$ += GW_ADD_RADIO$(first_radio, "Fourth option") last_radio = GW_LAST_ID() % Add the panel. panel = GW_ADD_PANEL(p, html$) % Add a listener on it. GW_ADD_LISTENER(p, panel, "close", "PanelClosed") % Add a button GW_ADD_BUTTON(p, "Open settings panel", GW_SHOW_PANEL$(panel)) % Now show the page. GW_RENDER(p) DO % Wait for user action. r$ = GW_WAIT_ACTION$() % User closed the panel. IF r$ = "PanelClosed" & !choice % What option did the user pick? FOR i = first_radio TO last_radio IF GW_RADIO_SELECTED(i) THEN choice = i - first_radio + 1 NEXT % User picked an option. IF choice <> 0 html$ = GW_ADD_TITLE$("Settings") html$ += GW_ADD_TEXT$("Option #"+INT$(choice)+" was chosen.") GW_MODIFY(panel, "content", html$) POPUP "Choice saved.\nOpen panel again." ENDIF ENDIF % End of panel closed % End when BACK key is pressed. UNTIL r$ = "BACK" END "End of Changing panel content example."